﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace DatabaseViewer.Domain
{
    public class CustomDataContext : System.Data.Linq.DataContext
    {
        private static System.Data.Linq.Mapping.MappingSource mappingSource = new System.Data.Linq.Mapping.AttributeMappingSource();

        public CustomDataContext(string databaseName, string connectionString)
            : base(connectionString, mappingSource)
        {            
            // Add the databasename to the context
            TypeDescriptor.AddAttributes(this, new Attribute[] 
                                    {
                                        new System.Data.Linq.Mapping.TableAttribute() { Name = databaseName }
                                    });
        }       
    }
}
